package edu.tongji.engine.db.dao;

import edu.tongji.engine.common.Log;
import edu.tongji.engine.db.HibernateTemplate;
import edu.tongji.engine.def.Transition;

public class TransitionDao implements ITransition{

private HibernateTemplate session;

	public TransitionDao(){
		session = new HibernateTemplate();
	}
	public boolean saveTransition(Transition trans) {
		try{
			session.saveOrUpdate(trans);
			return true;
			}
			catch(Exception e){
				System.out.println(e.toString());
				Log.getLoger().loger.error("save Transition Object Fail! ", e);
				return false;
			}
	}
	public boolean deleteAllTransitions() {
		try{
			String hql = "delete from Transition";
			session.deleteByHQL(hql);
			return true;
			}
			catch(Exception e){
				System.out.println(e.toString());
				Log.getLoger().loger.error("delete all Objects Fail! ", e);
				return false;
			}
	}

}
